<?php
if ( !defined( "IN_OP" ) )
{
    exit( "You can't access this file directly..." );
}
if ( ( $curruser['acl'] < 255 || $curruser['acl'] == 255 && $curruser['prev_id'] != 0 ) && !SubAccountRight( $curruser, 1 ) )
{
    diemsg( "你不是管理者！" );
}
$ui = new UI();
$tpl = new Template2();
global $curruser;
$user = new User();
$rs = getdb( "select id,round,open,spec from lotto where open>='".date( "Y-m-d" )."' order by open" );
if ( $rs->eof )
{
    $ui->showErrorPage( "<p>目前没有期数！</p>" );
    exit();
}
$lotto_id = $rs->f['id'];
$round = $rs->f['round'];
$open = $rs->f['open'];
$opnumber = $rs->f['spec'];
$rs->close();
$tpl->set( "lotto_id", $lotto_id );
$tpl->set( "round", d3( $round ) );
$tpl->set( "open", $open );
$conf = new config();
$stopbet = $conf->get( "stopbet" );
$startmode = "";
if ( date( "Y-m-d" ) < $open )
{
    $startmode = "disabled";
}
else if ( date( "Y-m-d" ) == $open )
{
    if ( $stopbet <= date( "Hi" ) && 0 < $opnumber )
    {
        $startmode = "disabled";
    }
    else if ( date( "Hi" ) <= $conf->get( "startbet" ) )
    {
        $startmode = "disabled";
    }
}
$t1 = strtotime( $open." ".$stopbet );
$tpl->Set( "timestap", $t1 - systime( ) );
$tpl->set( "phptime", systime( ) );
$b11 = isset( $_COOKIE['b131'] ) ? $_COOKIE['b131'] : "";
$tpl->set( "b131", $b11 );
$b12 = isset( $_COOKIE['b132'] ) ? $_COOKIE['b132'] : "";
$tpl->set( "b132", $b12 );
$b13 = "";
$tpl->set( "b133", $b13 );
$b21 = isset( $_COOKIE['b141'] ) ? $_COOKIE['b141'] : "";
$tpl->set( "b141", $b21 );
$b22 = isset( $_COOKIE['b142'] ) ? $_COOKIE['b142'] : "";
$tpl->set( "b142", $b22 );
$b23 = "";
$tpl->set( "b143", $b23 );
$b31 = isset( $_COOKIE['b181'] ) ? $_COOKIE['b181'] : "";
$tpl->set( "b181", $b31 );
$b32 = isset( $_COOKIE['b182'] ) ? $_COOKIE['b182'] : "";
$tpl->set( "b182", $b32 );
$b33 = "";
$tpl->set( "b183", $b33 );
$tpl->set( "startnowdisable", $startmode );
$prot_user = array();
$j = 0;
$i = 0;
while ( $i < 10 )
{
    $name = $conf->get( "port_systemuser_".$i );
    if ( $name != "" )
    {
        $prot_user[$j] = $name;
        ++$j;
    }
    ++$i;
}
$userrame1 = "&nbsp;<select name=usr1 style='display:none'><option value='' selected> </option>";
$i = 0;
while ( $i < $j )
{
    $userrame1 .= "<option value='".$i."'>".$prot_user[$i]."</option>";
    ++$i;
}
$userrame1 .= "</select>";
$tpl->set( "select_usr1", $userrame1 );
$userrame2 = "&nbsp;<select name=usr2 style='display:none'><option value='' selected> </option>";
$i = 0;
while ( $i < $j )
{
    $userrame2 .= "<option value='".$i."'>".$prot_user[$i]."</option>";
    ++$i;
}
$userrame2 .= "</select>";
$tpl->set( "select_usr2", $userrame2 );
$userrame3 = "&nbsp;<select name=usr3 style='display:none'><option value='' selected> </option>";
$i = 0;
while ( $i < $j )
{
    $userrame3 .= "<option value='".$i."'>".$prot_user[$i]."</option>";
    ++$i;
}
$userrame3 .= "</select>";
$tpl->set( "select_usr3", $userrame3 );
include_once( "class_6h/class.menu.php" );
$fieldArr = array( "round" => $round, "open" => $open, "lotto_id" => $lotto_id, "split_id" => 1 );
$onlineMenu = new menu_6h( 2, $fieldArr );
$selectid = getvar( "select" ) == "" ? 0 : getvar( "select" );
$menuList = $onlineMenu->getMenu( $selectid );
$tpl->set( "menuList", $menuList );
unset( $onlineMenu );
$tpl->load( "main", "unow12.htm" );
$tpl->set( "jslang", $g_conf['language'] );
$tpl->show( "main" );
$ui->footer();
?>